<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>商品列表 - 在线商城</title>
    <style>
        .product-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            padding: 20px;
        }
        .product-card {
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 15px;
            width: 250px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .product-image {
            width: 100%;
            height: 200px;
            background-color: #f5f5f5;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 10px;
        }
        .product-name {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 5px;
        }
        .product-price {
            color: #e74c3c;
            font-size: 20px;
            font-weight: bold;
        }
        .product-intro {
            color: #666;
            margin: 10px 0;
        }
    </style>
</head>
<body>
    <%@ include file="../header.jsp" %>
    
    <h1>商品列表</h1>
    
    <div class="product-container">
        <!-- 示例商品卡片 -->
        <div class="product-card">
            <div class="product-image">
                [商品图片]
            </div>
            <div class="product-name">示例商品1</div>
            <div class="product-intro">这是示例商品的简短介绍</div>
            <div class="product-price">¥99.00</div>
            <button onclick="addToCart(1)">加入购物车</button>
            <button onclick="viewDetail(1)">查看详情</button>
        </div>
        
        <div class="product-card">
            <div class="product-image">
                [商品图片]
            </div>
            <div class="product-name">示例商品2</div>
            <div class="product-intro">这是另一个示例商品的简短介绍</div>
            <div class="product-price">¥199.00</div>
            <button onclick="addToCart(2)">加入购物车</button>
            <button onclick="viewDetail(2)">查看详情</button>
        </div>
    </div>
    
    <script>
        function addToCart(productId) {
            alert('商品 ' + productId + ' 已添加到购物车');
            // 实际项目中这里会发送请求到后端
        }
        
        function viewDetail(productId) {
            window.location.href = 'detail.jsp?id=' + productId;
        }
    </script>
</body>
</html>